<html>
<head><meta charset="utf-8"><title>Building rmeta and rlib separately? · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Building.20rmeta.20and.20rlib.20separately.3F.html">Building rmeta and rlib separately?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="242255305"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Building%20rmeta%20and%20rlib%20separately%3F/near/242255305" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oxalica <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Building.20rmeta.20and.20rlib.20separately.3F.html#242255305">(Jun 10 2021 at 19:07)</a>:</h4>
<p>I'm using another build system like gnumake, which only know output is ready if process terminated. So I cannot rely on <code>--emit metadata,link</code> with artifact notifications to launch dependent built once rmeta is ready, like cargo. How can I make two rustc invocation to first build rmeta for dependent crates, and then build rlib without re-compile rmeta again?<br>
I tried only <code>--emit=metadata</code>, and the output rmeta is smaller than which is produced by <code>--emit=metadata,link</code>, which makes me confused.<br>
Also I cannot found way to build rlib and benefit from pre-built rmeta. Simply <code>--emit=link</code> takes the same time as <code>--emit=metadata,link</code> although rmeta is already there.</p>



<a name="242258835"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Building%20rmeta%20and%20rlib%20separately%3F/near/242258835" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Building.20rmeta.20and.20rlib.20separately.3F.html#242258835">(Jun 10 2021 at 19:34)</a>:</h4>
<p>jsgf is working on adding support for this, you may want to look at <a href="https://github.com/rust-lang/rust/pull/85793">https://github.com/rust-lang/rust/pull/85793</a> and <a href="https://github.com/rust-lang/rust/pull/86045">https://github.com/rust-lang/rust/pull/86045</a>.</p>



<a name="242259331"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Building%20rmeta%20and%20rlib%20separately%3F/near/242259331" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oxalica <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Building.20rmeta.20and.20rlib.20separately.3F.html#242259331">(Jun 10 2021 at 19:38)</a>:</h4>
<p><span class="user-mention" data-user-id="120518">@Eric Huss</span> Thanks. That's about metadata generation. But is it able to use previous rmeta to speed up rlib compilation? Currently emitting rlib cost exact the same time as emitting both rmeta and rlib.</p>



<a name="242259678"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Building%20rmeta%20and%20rlib%20separately%3F/near/242259678" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Building.20rmeta.20and.20rlib.20separately.3F.html#242259678">(Jun 10 2021 at 19:41)</a>:</h4>
<p>Not with just <code>--emit=metadata</code>, the rmeta file is incomplete.  I don't know the full details, but it looks like from the PR he is going to pursue using <code>--emit link -Zno-codegen</code> instead, but there are issues that it looks like he is working to resolve on that front.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>